from conans import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
import os

class FRCRobotConan(ConanFile):
    author = "1706"
    settings = "os", "compiler", "build_type", "arch"
    requires = "allwpilib/latest"
    generators = "cmake_find_package", "markdown"
    url = "https://github.com/rr1706/Control2021"
    default_options = {}

    _cmake = None

    def imports(self):
        self.copy("*.so", dst="bin", src="lib") # From lib to bin
        self.copy("*.dll", dst="bin", src="bin") # From bin to bin
        self.copy("*.dylib*", dst="bin", src="lib") # From lib to bin

    def generate(self):
        tc = CMakeToolchain(self)
        tc.generate()
        deps = CMakeDeps(self)
        deps.generate()

    def build(self):
        _cmake = CMake(self)
        _cmake.configure()
        _cmake.build()


    #def test(self):
    #    if not tools.cross_building(self):
    #        cmd = os.path.join(self.cpp.build.bindirs[0], "FRCUserProgram")
    #        self.run(cmd, env="conanrunenv")
